import Opt from '@/components/dt/info/Opt.js'
import table from '@/components/dt/table/render.js'
let _this = null
class Column extends Opt {
  constructor(vm) {
    super()
    _this = vm
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    this.all = [
      {
        title: '事业部',
        field: 'orgDivisionName',
        minWidth: 250
      },
      {
        title: '子公司',
        field: 'orgCompanyName',
        minWidth: 180
      },
      {
        title: '案场名称',
        field: 'buildingName',
        minWidth: 180
      },
      {
        title: '案场状态',
        field: 'buildingStatusName',
        minWidth: 180
      },
      {
        title: '在案角色',
        field: 'rolesName',
        minWidth: 180
      },
      {
        title: '员工',
        field: 'userNameAndWorkNo',
        minWidth: 180
      },
      {
        title: '头像',
        field: 'avatarUrl',
        minWidth: 180,
        slots: {
          default: (params, h) => {
            let img = {
              event: params.row.avatarUrl ? 'lookImg' : '',
              src: params.row.avatarUrl
                ? params.row.avatarUrl
                : 'https://static.tospurfang.com/dt-management/caseRate/tou.png',
              data: [
                params.row.avatarUrl
                  ? params.row.avatarUrl
                  : 'https://static.tospurfang.com/dt-management/caseRate/tou.png'
              ]
            }
            return table.cell.img(_this, h, img, true)
            // return params.row.avatarUrl ? table.cell.img(_this, h, img, true) : '-'
          }
        }
      }
    ]
  }
}

export default Column
